<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>自定义对象的原型设置</title>
  </head>
  <body></body>
  <script>
    let hd = { name: "hd" };
    let parent = {
      name: "parent",
      show() {
        console.log("parent method:" + this.name);
      }
    };
    Object.setPrototypeOf(hd, parent);
    console.log(hd);

    console.log(Object.getPrototypeOf(hd));
    hd.show();
    parent.show();
  </script>
</html>
